package cn.wen.yaling.controller;

import cn.wen.yaling.aop.annotation.operation.OperationLogger;
import cn.wen.yaling.aop.annotation.visit.BusinessLog;
import cn.wen.yaling.commons.enums.EBehavior;
import cn.wen.yaling.commons.utils.ResultEntity;
import cn.wen.yaling.commons.vo.*;
import cn.wen.yaling.xo.service.ArticleService;
import cn.wen.yaling.xo.service.CommentService;
import cn.wen.yaling.xo.service.WebVisitService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 
 *
 * @author FY
 * @email 932043654@qq.com
 * @date 2022-08-13 02:07:37
 */
@Slf4j
@RestController
public class WebVisitController {

    @Autowired
    private WebVisitService webVisitService;

    @ApiOperation(value = "获取用户访问列表", notes = "获取用户访问列表")
    @GetMapping("/admin/visit/list")
    public ResultEntity getList() {
        return webVisitService.getWebVisitList();
    }

    @ApiOperation(value = "查询获取用户访问列表", notes = "查询获取用户访问列表")
    @PostMapping("/admin/visit/search/list")
    public ResultEntity searchWebVisitList(@RequestBody WebVisitQueryVO queryVO) {
        return webVisitService.searchWebVisitList(queryVO);
    }


    @ApiOperation(value = "批量删除用户日志列表", notes = "批量删除用户日志列表", response = ResultEntity.class)
    @PostMapping(value = "/admin/visit/delete")
    public ResultEntity deleteBatchLog(@RequestParam("webVisitIds") Integer[] webVisitIds) {
        return webVisitService.deleteBatchLogByIds(webVisitIds);
    }


}
